﻿using BrnMall.Sms;
using QiDong.PC.Api.AppCode;
using System;
using System.Web;
using WeiTap.Restful;

namespace QiDong.PC.Api.Controllers
{
    public class HomeController : WebApi
    {
       
        /// <summary>
        /// 获取数据，json格式返回
        /// </summary>
        /// <param name="mothod"></param>
        /// <returns></returns>
        public string Json(string mothod)

        {
            if (string.IsNullOrEmpty(mothod))
                return "action不能为空";

            return WebUtil.RequestToJson(mothod);
        }

        /// <summary>
        /// 发送手机验证码
        /// </summary>
        /// <param name="phone"></param>
        /// <returns></returns>
        public bool SendCode(string phone)
        {
            bool re =SMSHelper.SendCode(phone, 1);

            if (re == true)
            {
                return true;
            }
            else
            {
                return false;
            }

        }

        ///// <summary>
        ///// 获取数据，JSONP格式返回
        ///// </summary>
        ///// <param name="mothod"></param>
        ///// <param name="callback"></param>
        ///// <returns></returns>
        //public string Jsonp(string mothod, string callback)
        //{
        //    if (string.IsNullOrEmpty(mothod))
        //        return "action不能为空";

        //    return WebUtil.RequestToJsonp(mothod, callback);
        //}

    }
}
